<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>查询用户信息</title>


</head>
<script type="text/javascript" src="../js/jquery-1.8.3.js"></script>
<style>
    .middle{
        margin: auto;
        background-color: greenyellow;
    }
</style>
<body>
    <div class="main-box">
        <div class="top">
        </div>
        <div class="middle">
            <div class="menu">

            </div>
            <div id="main">
                <div class="wel">
                    客户列表
                    <table>
                        <tr>
                            <td>姓名</td>
                            <td>身份证号</td>
                            <td>电话号码</td>

                        </tr>
                        <c:forEach items="${userList}" var="t" varStatus="line">
                            <tr class="${line.count % 2 == 0 ? 'even':''}">
                                <td id="trueName">${t.name}</td>
                                <td id="idCard">${t.idCard}</td>
                                <td id="telNum">${t.telNum}</td>
                            </tr>
                        </c:forEach>

                    </table>
                    <div>
                        <button id="add">添加人员</button>
                    </div>
<div>
    <button id="back">返回首页</button>
</div>
                </div>
            </div>
        </div>
    </div>



</body>
<script type="text/javascript" src="./js/jquery-1.8.3.js"></script>
<script>
    $("#add").bind("click",function () {
        location.href = "/usersOther/toadd?myuserId="+${userId}

    })
$("#back").bind("click",function () {
    location.href="/"
    }
)

$("#trueName").bind("blur",function () {//失焦才如此
    var trueName=$("#trueName");//取得众多姓名
    for(var i=0;i<trueName.length;i++ ){
        /*
          隐藏名字第一个字
         */
        huifuname1= trueName[i].innerText;//单个姓名
        var huifuname2 = huifuname1.substr(1,huifuname1.length);//抽取单个姓名的后几个字
        var huifuname3 = '* '+huifuname2;//以星号拼接名字
        $("#trueName")[i].innerText=huifuname3;//该行名字把赋值为：星号加名字
    }

// *记  *杰  *王子
})
//身份证
$("#idCard").bind("blur",function () {
    //失焦才如此
    //身份证：
    var idCard=$("#idCard");
    for(var i=0;i<idCard.length;i++){
        huifusfh1= idCard[i].innerText;
        var huifusfh2 = huifusfh1.substr(0,3);
        var huifusfh3 = huifusfh1.substr(14,4);
        var huifusfh4 = huifusfh2 + ' **** ' + huifusfh3;
        $("#idCard")[i].innerText=huifusfh4;
    }
})
//电话号
$("#telNum").bind("blur",function () {
    //失焦才如此
    var telNum=$("#telNum");
    for(var i=0;i<telNum.length;i++){
        huifusfh1= telNum[i].innerText;
        var huifusfh2 = huifusfh1.substr(7,11);
        var huifusfh3 =  ' ****** ' + huifusfh2;
        $("#telNum")[i].innerText=huifusfh3;
    }
})




</script>
<script type="text/javascript" src="/js/jquery-1.8.3.js"></script>
<script type="text/javascript" src="/js/jump.js"></script>
</html>
